package com.github.eclipseace.mybatis.pagination;

import org.apache.ibatis.session.RowBounds;

/**
 * @author eclipseAce
 */
public class PageRowBounds extends RowBounds {
	public PageRowBounds(int index, int size) {
		super(index * size, size);
	}

	public int getIndex() {
		int offset = getOffset();
		int limit = getLimit();
		return offset % limit == 0 ? offset / limit : offset / limit + 1;
	}

	public int getSize() {
		return getLimit();
	}
}
